import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:flutter_scaffold/flutter_scaffold.dart';

class ButtonDemoPage extends StatefulWidget {
  const ButtonDemoPage({super.key});

  @override
  State<ButtonDemoPage> createState() => _ButtonDemoPageState();
}

class _ButtonDemoPageState extends State<ButtonDemoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("button使用")),
      body: Container(
        width: double.infinity,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              style: ElevatedButton.styleFrom(overlayColor: Colors.blue),
              onPressed: () {
                Fluttertoast.showToast(msg: "你好");
              },
              child: Text("normal"),
            ),
            TextButton(
              style: ElevatedButton.styleFrom(overlayColor: Colors.transparent),
              onPressed: () {
                Fluttertoast.showToast(msg: "你好");
              },
              child: Text("你好"),
            ),
            OutlinedButton(
              onPressed: () {
                Fluttertoast.showToast(msg: "你好");
              },
              child: Text("你好"),
            ),
            FilledButton(
              onPressed: () {
                Fluttertoast.showToast(msg: "你好");
              },
              child: Text("你好"),
            ),
            IconButton(onPressed: () {}, icon: Icon(Icons.add)),

            TextButton.icon(
              onPressed: () {},
              label: Text("设置"),
              iconAlignment: IconAlignment.start,
              icon: Icon(Icons.settings),
            ),
            TweenAnimationBuilder(
              tween: Tween<double>(begin: 0.0, end: 1.0),
              duration: Duration(seconds: 2),
              builder: (context, value, child) {
                return CircularProgressIndicator(
                  value: value,
                  strokeCap: StrokeCap.round,
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}
